package com.daftv.springboot_test02.controller;

import com.daftv.springboot_test02.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Controller
public class TableController {
    @Resource
    private User user;

    @RequestMapping("/base")
    public String base() {
        return "base";
    }

    @RequestMapping("/userList")
    public String userList(Model model) {
        List<User> userList = new ArrayList<>();
        for (int i = 1; i < 11; i++) {
            User user2 = new User();
            user2.setUserName("张三" + i);
            user2.setPassword("zhangsan" + i);
            userList.add(user2);
        }
        model.addAttribute("userList", userList);
        return "user/userList";
    }
}
